<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="JNI,NDK,C++,Android Studio," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="Android 进阶系列的第二篇。 NDK 环境搭建，基础知识整理，学习目标。  NDK开发环境安装Android Studio 以及 NDK 安装参考 ,文中作者给出的参考是 1.3beta 版本，最新版本为 2.0 release ，安装思路是一致的，这里不再重复。">
<meta name="keywords" content="JNI,NDK,C++,Android Studio">
<meta property="og:type" content="article">
<meta property="og:title" content="NDK step by step 1">
<meta property="og:url" content="http://imesong.com/2016/04/24/2016/NDK-step-by-step-1/index.html">
<meta property="og:site_name" content="imesong">
<meta property="og:description" content="Android 进阶系列的第二篇。 NDK 环境搭建，基础知识整理，学习目标。  NDK开发环境安装Android Studio 以及 NDK 安装参考 ,文中作者给出的参考是 1.3beta 版本，最新版本为 2.0 release ，安装思路是一致的，这里不再重复。">
<meta property="og:image" content="http://7xrkqt.com1.z0.glb.clouddn.com/blogimage/2016/gradle_version_list.png">
<meta property="og:updated_time" content="2017-04-19T04:36:25.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="NDK step by step 1">
<meta name="twitter:description" content="Android 进阶系列的第二篇。 NDK 环境搭建，基础知识整理，学习目标。  NDK开发环境安装Android Studio 以及 NDK 安装参考 ,文中作者给出的参考是 1.3beta 版本，最新版本为 2.0 release ，安装思路是一致的，这里不再重复。">
<meta name="twitter:image" content="http://7xrkqt.com1.z0.glb.clouddn.com/blogimage/2016/gradle_version_list.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://imesong.com/2016/04/24/2016/NDK-step-by-step-1/"/>





  <title> NDK step by step 1 | imesong </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?cb36183ed65a7652b909d352ab2166";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">imesong</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">Change the world by coding!</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://imesong.com/2016/04/24/2016/NDK-step-by-step-1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="imesong">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://7xrkqt.com1.z0.glb.clouddn.com/avatar.jpg-avatar">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="imesong">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                NDK step by step 1
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-04-24T11:54:49+08:00">
                2016-04-24
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/JNI/" itemprop="url" rel="index">
                    <span itemprop="name">JNI</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body han-init-context" itemprop="articleBody">

      
      

      
        <blockquote>
<p><strong>Android 进阶系列的第二篇</strong>。 NDK 环境搭建，基础知识整理，学习目标。</p>
</blockquote>
<h3 id="NDK开发环境安装"><a href="#NDK开发环境安装" class="headerlink" title="NDK开发环境安装"></a>NDK开发环境安装</h3><p><strong><a href="http://blog.csdn.net/sbsujjbcy/article/details/48469569" target="_blank" rel="external">Android Studio 以及 NDK 安装参考</a></strong> ,文中作者给出的参考是 1.3beta 版本，最新版本为 2.0 release ，安装思路是一致的，这里不再重复。<br><a id="more"></a></p>
<ul>
<li><a href="http://tools.android.com/download/studio/builds/2-0" target="_blank" rel="external">Android Studio 2.0 下载安装</a></li>
<li>使用 Android Studio SDK Manager 安装 NDK 或者 <a href="http://developer.android.com/ndk/downloads/index.html" target="_blank" rel="external">官网下载安装</a></li>
<li>配置NDK路径以及环境变量</li>
</ul>
<h3 id="Gradle-DSL"><a href="#Gradle-DSL" class="headerlink" title="Gradle DSL"></a>Gradle DSL</h3><p>Android Studio 2.0 中 使用的 gradle 版本默认为 2.10，对应的 <strong>gradle-experimental</strong> 版本为 0.6-alpha5 以及以上版本。具体的对应关系 <a href="http://tools.android.com/tech-docs/new-build-system/gradle-experimental" target="_blank" rel="external">参考官网</a></p>
<p><img src="http://7xrkqt.com1.z0.glb.clouddn.com/blogimage/2016/gradle_version_list.png" alt="gradle 与 gradle-experimental 对应关系"></p>
<p>期待1.0 正式版本发布之后，对NDK的支持能更友好。</p>
<h3 id="学习资料"><a href="#学习资料" class="headerlink" title="学习资料"></a>学习资料</h3><ul>
<li><p><a href="http://androiddoc.qiniudn.com/ndk/guides/index.html" target="_blank" rel="external">官方文档</a>，官方文档现在的教程还是在用 Eclipse ＋ADT ＋ NDK ，推荐大家使用 Android Studio ＋NDK，这个是未来的趋势，替代 Eclipse ＋ADT＋NDK 是必然。</p>
</li>
<li><p>官方Demo的更新很频繁，是最好的学习参考。<br><a href="https://github.com/googlesamples/android-ndk" target="_blank" rel="external">NDK 的官方Demo地址</a> </p>
</li>
<li><p>图书参考 <strong><a href="http://item.jd.com/11390406.html" target="_blank" rel="external">Android C++高级编程 使用NDK</a></strong>,不过书中给的Demo 都是使用 Eclipse。</p>
</li>
</ul>
<h3 id="NDK基础知识"><a href="#NDK基础知识" class="headerlink" title="NDK基础知识"></a>NDK基础知识</h3><p>NDK涉及的知识比较广泛</p>
<ul>
<li>JNI</li>
<li>Gradle</li>
<li>C/C＋＋ </li>
<li>Linux</li>
<li>具体业务</li>
</ul>
<p>如果没有目标，在这么多多方向里，很可能不知道最终要干什么，学着后面的，忘了前面的。</p>
<h3 id="学习目标"><a href="#学习目标" class="headerlink" title="学习目标"></a>学习目标</h3><ul>
<li>了解JNI,掌握基础用法</li>
<li>了解Gradle ,掌握常用编译选项和命令</li>
<li>熟悉 Linux 基础操作和命令</li>
<li>具体业务是 Chromium 内核，JNI 相关的模块</li>
</ul>

      
    </div>

    <div>
      
        
<div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center">
    <img id="wechat_subscriber_qcode" src="http://7xrkqt.com1.z0.glb.clouddn.com/WechatCode.jpeg" alt="imesong wechat" style="width: 200px; max-width: 100%;"/>
    <div>添加关注</div>
</div>


      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/JNI/" rel="tag"># JNI</a>
          
            <a href="/tags/NDK/" rel="tag"># NDK</a>
          
            <a href="/tags/C/" rel="tag"># C++</a>
          
            <a href="/tags/Android-Studio/" rel="tag"># Android Studio</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/05/20/2016/Androi高级编程读书笔记/" rel="next" title="Androi高级编程读书笔记">
                <i class="fa fa-chevron-left"></i> Androi高级编程读书笔记
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/04/19/2016/JNI-step-by-step-0/" rel="prev" title="JNI step by step 0">
                JNI step by step 0 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://7xrkqt.com1.z0.glb.clouddn.com/avatar.jpg-avatar"
               alt="imesong" />
          <p class="site-author-name" itemprop="name">imesong</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">18</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">7</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">27</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/imesong" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/youyoubaren/home?wvr=5" target="_blank" title="Weibo">
                  
                    <i class="fa fa-fw fa-weibo"></i>
                  
                  Weibo
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/imesong" target="_blank" title="Zhihu">
                  
                    <i class="fa fa-fw fa-zhihu"></i>
                  
                  Zhihu
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://www.jianshu.com/users/25e16af753ad/latest_articles" target="_blank" title="Jianshu">
                  
                    <i class="fa fa-fw fa-jianshu"></i>
                  
                  Jianshu
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#NDK开发环境安装"><span class="nav-number">1.</span> <span class="nav-text">NDK开发环境安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Gradle-DSL"><span class="nav-number">2.</span> <span class="nav-text">Gradle DSL</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#学习资料"><span class="nav-number">3.</span> <span class="nav-text">学习资料</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#NDK基础知识"><span class="nav-number">4.</span> <span class="nav-text">NDK基础知识</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#学习目标"><span class="nav-number">5.</span> <span class="nav-text">学习目标</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">imesong</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  





  





  






  





  

  

  

  

  

</body>
</html>
